import java.util.*;
public class Main {
    /**
     * 字符串拼接
     * @param args
     */
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String[] str=new String[4];
        for(int i=0;i<4;i++){
            str[i]=in.next();
        }
        Arrays.sort(str,(o1,o2)->(o1+o2).compareTo(o2+o1));
        for(int i=0;i<4;i++){
            System.out.print(str[i]);
        }
        in.close();
    }
    /**
     * 互质的数
     * @param args
     */
    public static void main1(String[] args) {
        int cnt=0;
        long i=1;
        while(cnt<2024){
            if(gac(i,2024)==1){
                cnt++;
            }
            i++;
        }
        System.out.println(i);
    }
    public static long gac(long a,long b){
        while(b!=0){
            long tmp=b;
            b=a%b;
            a=tmp;
        }
        return a;
    }
}